import R from "@common/type/response";
import { NextApiResponse } from "next";
import * as roleService from '@/common/service/sys_role';
import { AuthenticatedRequest, withAuth } from '@common/middleware/auth';

export async function handler(req: AuthenticatedRequest, res: NextApiResponse) {
    const query = req.query;
    var start = query._start || 0;
    var end = query._end || 10;
    const data = await roleService.getRoles(query,start as number,end as number);
    R.success(res,data);
}

export default withAuth(handler);